home *** CD-ROM | disk | FTP | other *** search
- Path: news.lpr.carel.fi!usenet
- From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
- Newsgroups: comp.lang.c
- Subject: Re: 256 colors in BCG
- Date: Thu, 01 Feb 1996 11:32:04 +0200
- Organization: Carelcomp Forest
- Message-ID: <31108894.41F9@cmt.lpr.mail.carel.fi>
- References: <4enojq$4j@badger.wmin.ac.uk>
- NNTP-Posting-Host: renoir.cclahti.carel.fi
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b6a (WinNT; I)
-
- Declan Kruppa wrote:
- >
- > I am using a borland compiler and want to write images to the screen
- > with 256 grey levels or alternatively 256 graded in a recognisable way
- > eg. rainbow. I know that in mode 13h I have acess to 256 colors
- > but at a lower resolution then vga. Also accessing mode 13h means
- > writing some assembly code. Is there a library on the net which will
- > give me 256 grey levels that can be called from a standard c programme.
- > thanks
- > Declan Kruppa
-
- Actually, mode 13h is one of the easiest modes to handle. When you're using it, you'll
- have 320x200 bytes of memory (abt. 64kB) starting at the address 0xa000:0000, which can be
- accessed, for example, by:
-
- /* large memory model, 16-bit program */
- unsigned char far *ptr = (unsigned char far *)0xa0000000UL;
-
- memset(ptr, 0, 320); /* Set first row to all black (0 defaults to black) */
-
- Ie. you just go and set the byte at the offset [y][x] (ptr + y * 320 + x) to the color
- index you want used (there are two INT 0x10 services to change the default palette
- mapping; see Ralph Brown's interrupt list). There is also a handy INT 0x10 service to set
- the mode to 256 shade gray, but I forgot it; again, check out Ralph Brown's interrupt
- list. You may also find the book 'Programming the PC & PS/2 Video Systems' (by Wilson?)
- from Microsoft Press worth looking at. It discusses other modes and video cards, too.
-
- Later,
- AriL
- --
- All my opinions are mine and mine alone.
-